﻿using System;

namespace UtfprLibrary.Exceptions {
    /// <summary>
    /// Defines the basis for all UtfprLibrary exceptions
    /// </summary>
    public abstract class UtfprExceptionBase : Exception {
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="errorMessage">the error message</param>
        public UtfprExceptionBase()
            : base(String.Format("[{0}]", Properties.Resources.Exceptions_UtfprExceptionBase_Const_BaseMessage)) {
            this.HelpLink = Properties.Resources.Exceptions_UtfprExceptionBase_Const_HelpLink;
        }

        /// <summary>
        /// Exposes a customized error message
        /// </summary>
        /// <param name="errorMessage">the error message</param>
        public UtfprExceptionBase(string errorMessage) 
            : base(String.Format( "[{0}] - {1}", Properties.Resources.Exceptions_UtfprExceptionBase_Const_BaseMessage, errorMessage)) {            
            this.HelpLink = Properties.Resources.Exceptions_UtfprExceptionBase_Const_HelpLink;
        }

        /// <summary>
        /// Exposes a customized error message and a inner exception
        /// </summary>
        /// <param name="errorMessage">the error message</param>
        /// <param name="innerException">the inner exception</param>
        public UtfprExceptionBase(string errorMessage, Exception innerException)
            : base(String.Format("[{0}] - {1}", Properties.Resources.Exceptions_UtfprExceptionBase_Const_BaseMessage, errorMessage), innerException) {
                this.HelpLink = Properties.Resources.Exceptions_UtfprExceptionBase_Const_HelpLink;
        }    
       
        /// <summary>
        /// TODO:
        /// </summary>
        public UtfprExceptionBase(string errorMessage, Exception innerException, string source)
            : base(String.Format("[{0}] - {1}", Properties.Resources.Exceptions_UtfprExceptionBase_Const_BaseMessage, errorMessage), innerException) {
                this.HelpLink = Properties.Resources.Exceptions_UtfprExceptionBase_Const_HelpLink;
            this.Source = source;
        }
    }
}

